Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android - Fix failed to build unique file crash #278

Merged

Conversation

bernhardoj
Copy link

Description

On Android, copying files to a media store (copyToMediaStore) with the same name more than 32 times will crash the app. I'm not sure if the number is vary depends on the device, but on the 33rd time, the app crashed.

image

The error itself comes from this line of code.

// Keeps a handle to the new file's URI in case we need to modify it later.
return resolver.insert(mediauri, fileDetails);

This PR wraps it with a try-catch. Now, a promise rejection warning will show instead of an error. It would be the developer's responsibility to handle the rejection.

@RonRadtke RonRadtke merged commit 728bd81 into RonRadtke:master Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants